package com.huang.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.huang.dao.UserDao;
import com.huang.entity.UserEntity;
import com.huang.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;

    @Override
    public UserEntity get() {
        return userDao.selectByPrimaryKey(1);
    }

    @Override
    public List<UserEntity> list() {
        Page<UserEntity> page = PageHelper.startPage(1, 10);
        return userDao.select();
    }

    @Override
    public void insert(UserEntity userEntity) {
        userDao.insert(userEntity);
    }
}
